using System;
using PrimeTween;
using UnityEngine;
using UnityEngine.UI;

namespace UI
{
    public class StartMenu : MonoBehaviour
    {
        [SerializeField] private Image title;

        private bool _gameStarted;
        

        private void OnEnable()
        {
            InputBox.ChatMessageSubmitted += InputBox_ChatMessageSubmitted;
        }

        private void OnDisable()
        {
            InputBox.ChatMessageSubmitted -= InputBox_ChatMessageSubmitted;
        }

        private void InputBox_ChatMessageSubmitted(string _)
        {
            if (_gameStarted)
            {
                return;
            }
            
            _gameStarted = true;
            Tween.UIAnchoredPositionY(title.rectTransform, 0f, 0.5f, Ease.InExpo);
        }
    }
}
